package com.laihui;

import android.content.Context;

/**
 * Created by G150T on 2017/7/7.
 */

public class Constants {
    //正式服务器
    public static final String BASE_URL = "http://www.hongxinsuo.com/";
    public static final String BASE_URL_IMG = "http://www.hongxinsuo.com/";
    public static final String BASE_URL_CONTENT = "http://www.laihuitz.com/";

    public static final String USERID = "id";
    public static final String MOBILE_STATUS = "mobile_status";
    public static final String USERNAMECOOKIE = "cookieName";
    public static final String USERPASSWORDCOOKIE = "cookiePassword";
    public static final String USERREMEMBERCOOKIE = "cookieRemember";
    public static final String ISFIRSTSTART = "isFirstStart";
    public static final String ISNEW = "isNew";
    public static final String PHONECOOKIE = "cookiePhone";
    public static final String FIRST_OPEN = "first_open";

    /**
     * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
     */
    public static int dip2px(Context context, float dpValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dpValue * scale + 0.5f);
    }

    /**
     * 根据手机的分辨率从 px(像素) 的单位 转成为 dp
     */
    public static int px2dip(Context context, float pxValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (pxValue / scale + 0.5f);
    }
}
